#include<bits/stdc++.h>
using namespace std;
int alp[1000];
int t,tt;
void solve(){
	string a,b;
	getline(cin,a);
	getline(cin,b);
	int len1 = a.size();
	int len2 = b.size();
	for(int i = 0;i < 200;i++){
		alp[i] = 0;
	}
	for(int i = 0;i < len1;i++){
		if(a[i] >= 'a' && a[i] <= 'z'){
			alp[a[i] - 'a']++;
		}
		if(a[i] >= 'A' && a[i] <= 'Z'){
			alp[a[i] - 'A']++;
		}
	}
	for(int i = 0;i < len2;i++){
		if(b[i] >= 'a' && b[i] <= 'z'){
			alp[b[i] - 'a']--;
		}
		if(b[i] >= 'A' && b[i] <= 'Z'){
			alp[b[i] - 'A']--;
		}
	}
	int flag1 = 0;
	for(int i = 0;i < 26;i++){
		if(alp[i] < 0){
			flag1 = 1;
		}
	}
	if(flag1 == 0){//没有负的
		cout << "Case " << t - tt << ": Yes" << "\n";
		return;
	}
	flag1 = 0;
	for(int i = 0;i < 26;i++){//没有正的
		if(alp[i] > 0){
			flag1 = 1;
		}
	}
	if(flag1 == 0){//没有负的
		cout << "Case " << t - tt << ": Yes" << "\n";
		return;
	}
	cout << "Case " << t - tt << ": No" << "\n";
}
int main(){
	cin >> t;
	tt = t;
	cin.ignore();
	while(tt--) solve();
}